home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
rexxutil.zip
/
REXTEST1.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-03-19
|
8KB
|
312 lines
/*** Rexx Cmd for Testing RexxUtil DLL functions - By David Ashley ***/
/*** Test Cmd for RexxUtil Version 1.00 ***/
trace 'o'
arg opt
if opt='REXRUNTEST' then do /* Used when testing RexRun */
say; say 'Hey, I am easily chaining the RexxUtil exec!'; say
exit
end
if opt='DELETE' then do /* Used to drop functions */
call RxFuncDrop('RexCls')
call RxFuncDrop('RexCopy')
call RxFuncDrop('RexDelete')
call RxFuncDrop('RexDir')
call RxFuncDrop('RexDirExist')
call RxFuncDrop('RexFileExist')
call RxFuncDrop('RexGetKey')
call RxFuncDrop('RexGetVersion')
call RxFuncDrop('RexPause')
call RxFuncDrop('RexQCurDisk')
call RxFuncDrop('RexRead')
call RxFuncDrop('RexRun')
call RxFuncDrop('RexSay')
call RxFuncDrop('RexSearchPath')
call RxFuncDrop('RexSem')
call RxFuncDrop('RexSetCurPos')
call RxFuncDrop('RexSleep')
call RxFuncDrop('RexUtilVersion')
call RxFuncDrop('RexWrite')
exit
end
/*** Add each desired function or it won't work ***/
call RxFuncAdd 'RexCls', 'REXXUTIL', 'REXCLS'
call RxFuncAdd 'RexCopy', 'REXXUTIL', 'REXCOPY'
call RxFuncAdd 'RexDelete', 'REXXUTIL', 'REXDELETE'
call RxFuncAdd 'RexDir', 'REXXUTIL', 'REXDIR'
call RxFuncAdd 'RexDirExist', 'REXXUTIL', 'REXDIREXIST'
call RxFuncAdd 'RexFileExist', 'REXXUTIL', 'REXFILEEXIST'
call RxFuncAdd 'RexGetKey', 'REXXUTIL', 'REXGETKEY'
call RxFuncAdd 'RexGetVersion', 'REXXUTIL', 'REXGETVERSION'
call RxFuncAdd 'RexPause', 'REXXUTIL', 'REXPAUSE'
call RxFuncAdd 'RexQCurDisk', 'REXXUTIL', 'REXQCURDISK'
call RxFuncAdd 'RexRead', 'REXXUTIL', 'REXREAD'
call RxFuncAdd 'RexRun', 'REXXUTIL', 'REXRUN'
call RxFuncAdd 'RexSay', 'REXXUTIL', 'REXSAY'
call RxFuncAdd 'RexSearchPath', 'REXXUTIL', 'REXSEARCHPATH'
call RxFuncAdd 'RexSem', 'REXXUTIL', 'REXSEM'
call RxFuncAdd 'RexSetCurPos', 'REXXUTIL', 'REXSETCURPOS'
call RxFuncAdd 'RexSleep', 'REXXUTIL', 'REXSLEEP'
call RxFuncAdd 'RexUtilVersion', 'REXXUTIL', 'REXUTILVERSION'
call RxFuncAdd 'RexWrite', 'REXXUTIL', 'REXWRITE'
say; say 'Functions have now been loaded.'
/*** Give greetings ***/
call RexCls
say; say 'This is a test exec for RexUtilVersion 'RexUtilVersion()'!'
call RexPause
/*** Test RexCls ***/
call RexCls; say
call RexPause 'This is a test of RexCls, press any key...'
call RexCls
say; say 'Did you see that quick screen-clear via RexCls?'
call RexPause
/*** Test RexCurPos ***/
call RexCls
say; say 'This is a test of RexCurPos...'
call RexSetCurPos '3', '0'
call RexPause 'Press a key'
call RexSetCurPos '10', '50'
call RexPause 'Press a key'
call RexSetCurPos '20', '20'
call RexPause 'Press a key'
call RexSetCurPos '5', '65'
call RexPause 'Press a key'
call RexSetCurPos '23', '0'
call RexPause
/*** Test RexCopy ***/
call RexCls
say; say 'Testing RexCopy by creating the file Rextemp1.fil:'
call RexCopy 'c:\config.sys', 'rextemp1.fil'
call RexPause
/*** Test RexDelete ***/
call RexCls
say; say 'Testing RexDelete by deleting the file Rextemp.fil:'
say 'Creating file first.'
RexCopy 'c:\config.sys', 'rextemp.fil'
say 'File created, attempting delete.'
call RexPause
if RexDelete('Rextemp.fil')=0 then
say 'The file Rextemp.fil has been deleted!'
else
say 'Could not delete Rextemp.fil!'
call RexPause
/*** Test RexDirExist ***/
call RexCls
say; say 'Testing RexDirExist by seeing if C:\TEMP exists:'
call RexPause
if RexDirExist('c:\temp') then
say 'Yes, it exists!'
else
say 'No, it does not exist!'
call RexPause
/*** Test RexQCurDisk ***/
call RexCls
say; say 'Testing RexQCurDisk by displaying all available drives:'
say RexQCurDisk()
call RexPause
/*** Test RexFileExist ***/
call RexCls
say; say 'Testing RexFileExist by seeing if REXTEMP.FIL exists:'
say 'Creating file first.'
RexCopy 'c:\config.sys', 'rextemp.fil'
say 'File created, testing existence.'
call RexPause
if RexFileExist('rextemp.fil') then
say 'Yes, it exists!'
else
say 'No, it does not exist!'
call RexPause
say 'Now deleting file.'
call RexDelete 'rextemp.fil'
say 'File deleted, testing existence.'
call RexPause
if RexFileExist('rextemp.fil') then
say 'Yes, it exists!'
else
say 'No, it does not exist!'
call RexPause
/*** Test RexGetKey ***/
call RexCls
say; say 'Testing RexGetKey, type a key:'
key = RexGetKey('ECHO')
say; say 'You pressed: 'key
resp=''
say; say; say 'You may use RexGetKey for entering password info!'
say 'Enter a secret password, then press Enter:'
do until c2d(key)=13
key=RexGetKey('NOECHO')
resp=resp||key
end
say 'Hey, you entered:' resp
call RexPause
/*** Test RexGetVersion ***/
call RexCls
say; say 'Test of RexGetVersion shows you are running OS/2 version ',
RexGetVersion()
call RexPause
/*** Test RexRead ***/
call RexCls
say; say 'Testing RexRead by reading in C:\CONFIG.SYS:'
call RexPause
call RexRead 'c:\config.sys', 'file'
say 'The number of lines in the file is' file.0'.'
say 'The listing of the file follows:'
call RexPause
do num=1 to file.0
say file.num
end
call RexPause
/*** Test RexRun ***/
call RexCls
say; say 'Testing RexRun by re-executing (ie chaining) RexTest...'
parse source . . fspec
drive = left(fspec,2)
call RexRun(drive'Rextest.cmd RexRunTest')
call RexPause
/*** Test RexPause ***/
call RexCls
call RexPause 'You are currently testing RexPause. Strike any key...'
/*** Test RexSay ***/
call RexCls
say; say 'This is a test of RexSay...'
call RexSay 'Please enter a string > '
resp = linein('STDIN')
say 'Did you notice everything appeared on one line?'
call RexPause
/*** Test RexSearchPath ***/
call RexCls
say; say 'Testing RexSearchPath by searching for DISPLAY.DLL in LIBPATH:'
call RexPause
say 'Directory containing DISPLAY.DLL is: ',
RexSearchPath('LIBPATH', 'display.dll')
say; say 'Testing RexSearchPath by searching for CMD.EXE in PATH:'
call RexPause
say 'Directory containing CMD.EXE is: 'RexSearchPath('PATH', 'cmd.exe')
call RexPause
/*** Test RexSleep ***/
call RexCls
say; say 'Testing RexSleep: Sleeping for 2 seconds...'
call RexSleep '2'
call RexPause
/*** Test RexUtilVersion ***/
call RexCls
say; say 'Test of RexUtilVersion shows you are using version ',
RexUtilVersion()
call RexPause
/*** Test RexWrite ***/
call RexCls
say; say 'Testing RexWrite by creating the file Rextemp.fil:'
call RexWrite 'Rextemp.fil', 'file', file.0, , 'r'
call RexPause
/*** Test RexFileSize ***/
call RexCls
say; say 'Testing RexFileSize by obtaining the size of Rextemp.fil:'
say 'The size of the file is 'RexFileSize('Rextemp.fil')
call RexPause
/*** Test RexRenameFile ***/
call RexCls
say; say 'Testing RexRenameFile by renaming Rextemp.fil to temp2.fil:'
say 'The return code from RexRenameFile is ',
RexRenameFile('Rextemp.fil', 'temp2.fil')
call RexPause
/*** Test RexDir ***/
call RexCls
say; say 'Testing RexDir by reading in C:\*.*:'
call RexPause
call RexDir 'c:\*.*', 'file', 'hsb'
do num=1 to file.0
say file.num
end
call RexPause
/*** Test RexSem ***/
call RexCls
say; say 'This is a test of RexSem...'
say 'Return code of \SEM\RXTEST semaphore ''Create'' =' ,
RexSem('\sem\rxtest', 'CREATE')
say 'Return code of semaphore ''Set'' =' RexSem('\sem\rxtest', 'SET')
say 'Return code of ''Wait for semaphore clear'' =' ,
RexSem('\sem\rxtest', 'WAIT', '1000')
say 'Return code of semaphore ''Clear'' =' RexSem('\sem\rxtest', 'CLEAR')
say 'Return code of ''Wait for semaphore clear'' =' ,
RexSem('\sem\rxtest', 'WAIT', '1000')
say 'Return code of semaphore ''Close'' =' RexSem('\sem\rxtest', 'CLOSE')
call RexPause
/*** Give Salutations ***/
call RexCls
say; say 'Bye'
/**** Drop all used functions ****/
call RxFuncDrop('RexCls')
call RxFuncDrop('RexCopy')
call RxFuncDrop('RexDelete')
call RxFuncDrop('RexDir')
call RxFuncDrop('RexDirExist')
call RxFuncDrop('RexFileExist')
call RxFuncDrop('RexGetKey')
call RxFuncDrop('RexGetVersion')
call RxFuncDrop('RexPause')
call RxFuncDrop('RexQCurDisk')
call RxFuncDrop('RexRead')
call RxFuncDrop('RexRun')
call RxFuncDrop('RexSay')
call RxFuncDrop('RexSearchPath')
call RxFuncDrop('RexSem')
call RxFuncDrop('RexSetCurPos')
call RxFuncDrop('RexSleep')
call RxFuncDrop('RexUtilVersion')
call RxFuncDrop('RexWrite')
exit